package com.zjsd.sqeybusiness.controller;

import java.util.List;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.zjsd.sqeybusiness.domain.Dzsjinfo;
import com.zjsd.sqeybusiness.service.IDzsjinfoService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 定制商机Controller
 *
 * @author Zheng
 * @date 2025-03-06
 */
@RestController
@RequestMapping("/sqeybusiness/dzsjinfo")
public class DzsjinfoController extends BaseController
{
    @Autowired
    private IDzsjinfoService dzsjinfoService;

    /**
     * 查询定制商机列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:list')")
    @GetMapping("/list")
    public TableDataInfo list(Dzsjinfo dzsjinfo)
    {
        startPage();
        List<Dzsjinfo> list = dzsjinfoService.selectDzsjinfoList(dzsjinfo);
        return getDataTable(list);
    }

    /**
     * 导出定制商机列表
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:export')")
    //@Log(title = "定制商机", businessType = BusinessType.EXPORT)
    @GetMapping("/export")
    public AjaxResult export(Dzsjinfo dzsjinfo)
    {
        List<Dzsjinfo> list = dzsjinfoService.selectDzsjinfoList(dzsjinfo);
        ExcelUtil<Dzsjinfo> util = new ExcelUtil<Dzsjinfo>(Dzsjinfo.class);
        return util.exportExcel(list, "dzsjinfo");
    }

    /**
     * 获取定制商机详细信息
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:query')")
    @GetMapping(value = "/{dzsjid}")
    public AjaxResult getInfo(@PathVariable("dzsjid") Long dzsjid)
    {
        return AjaxResult.success(dzsjinfoService.selectDzsjinfoById(dzsjid));
    }

    /**
     * 新增定制商机
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:add')")
    //@Log(title = "定制商机", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody Dzsjinfo dzsjinfo)
    {
        return toAjax(dzsjinfoService.insertDzsjinfo(dzsjinfo));
    }

    /**
     * 修改定制商机
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:edit')")
    //@Log(title = "定制商机", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody Dzsjinfo dzsjinfo)
    {
        return toAjax(dzsjinfoService.updateDzsjinfo(dzsjinfo));
    }

    /**
     * 删除定制商机
     */
    @PreAuthorize("@ss.hasPermi('sqeybusiness:dzsjinfo:remove')")
    //@Log(title = "定制商机", businessType = BusinessType.DELETE)
	@DeleteMapping("/{dzsjids}")
    public AjaxResult remove(@PathVariable Long[] dzsjids)
    {
        return toAjax(dzsjinfoService.deleteDzsjinfoByIds(dzsjids));
    }
}
